<!--
 * @Description: 新增会议
 * @Author: wind-lc
 * @version: 1.0
 * @Date: 2023-02-06 10:57:23
 * @LastEditTime: 2023-04-06 10:51:49
 * @FilePath: \cscec-pms-admin\src\views\project\projectPlanningMeeting\add.vue
-->
<template>
  <base-breadcrumb>
    <MeetingAdd
      ref="meetingAdd"
      :form="form"
      :form-option="formOption"
      :rules="rules"
      :meeting-type="'16'"
      :title="'基本信息'"
      :paramsFormat="paramsFormat"
      @selectOrg="selectOrg"
    >
      <template slot="speakerId">
        <SelectStaffWithTooltip
          v-model="form.speakerId"
          placeholder="请选择"
          label-in-value
          :request-params="
            {
              types:[0]
            }
          "
        />
      </template>
    </MeetingAdd>
  </base-breadcrumb>
</template>
<script>
import SelectStaffWithTooltip from '@/components/Select/SelectStaffWithTooltip'
import MeetingAdd from '@/components/Meeting/MeetingAdd'
import { formOption } from './model.js'
export default {
  name: 'projectPlanningMeetingAdd' + Date.now(),
  components: {
    SelectStaffWithTooltip,
    MeetingAdd
  },
  data () {
    return {
      // 表单项
      formOption,
      form: {
        meetingTypeName: '策划会议',
        employeeList:[],
        createUser: this.$store.state.user.userInfo.name,
        createTime: this.moment().format('YYYY-MM-DD')
      }
    }
  },
  computed:{
    // 校验
    rules() {
      const obj = {}
      this.formOption.map((item) => {
        if (item.rules) {
          obj[item.keyName] = item.rules
        }
      })
      return obj
    }
  },
  methods:{
    selectOrg(val) {
      this.form.branchComId = val[val.length - 2].orgId
    },
    /**
     * @description: 参数格式化
     * @param {object} data 参数
     * @return {void}
     */        
    paramsFormat(data){
      data.speakerId = data.speakerId?.key
    }
  }
}
</script>
<style lang="less" scoped>
</style>
